﻿///
/// Copyright, 
/// This application , code and content is free to copy and modify 
/// This code is for demo purposed only 
/// User at own risk. no legal obligations from my end.
/// The purpose of this code is to explore the SharePoint Audit facilities.
/// George Gergues , george.gergues@gmail.com
/// Thank you.
///

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using System.Data;
using System.Collections;

namespace TIS.SPAuditDemo
{
    public class SPCustomAuditEntry:IEnumerable
    {
        internal SPAuditEntry _SPAuditItem; 
        
        public SPCustomAuditEntry(SPAuditEntry spa)
        {
            _SPAuditItem = spa;        
        }

        #region Properties
        public SPAuditEntry SPAudit
        {
            get{return _SPAuditItem;}
            set{ _SPAuditItem = value;}
        }        
       
        public DateTime Occurred
        { get            {return  _SPAuditItem.Occurred.ToLocalTime(); }
        }
        
        public string EventType
        {
            get
            { return _SPAuditItem.Event.ToString(); }
            
        }
        
        public string EventSource
        {
            get
            {
                return _SPAuditItem.EventSource.ToString() ;
            }
            }

        public Guid SiteId
        { get { return _SPAuditItem.SiteId; } 
        }       

        public Guid ItemId
        {
            get
            { return _SPAuditItem.ItemId; }
            }

        public string ItemType
        {
            get
            {
               return _SPAuditItem.ItemType.ToString();
            }

            }

        public string LocationType
        {
            get{
            
                return _SPAuditItem.LocationType.ToString(); 
            }
            
        }

        public string DocLocation
        {
            get
            {
                return _SPAuditItem.DocLocation;
            }
        }

        public string EventData
        {
            get { return _SPAuditItem.EventData; }
        }

        public string EventName
        {
            get { return _SPAuditItem.EventName; }

        }

        public string MachineIP
        {
            get { return _SPAuditItem.MachineIP; }
        }

        public string MachineName
        {
            get { return _SPAuditItem.MachineName; }
        }
        public string SourceName
        {
            get { return _SPAuditItem.SourceName; }

        }

        /// <summary>
        /// The following are the extended properties.
        /// </summary>
        public string Version
        {get;set;}
      
        public string UserId
        {
            get;
            set;
        }

        public string SiteTitle
        {
            get;
            set;
        }
        public string SiteUrl
        {
            get;
            set;
        }


        public string ItemTitle
        {
            get;
            set;
        }

        public string ItemUrl
        {
            get;
            set;
        }
        
        #endregion
        
        #region IEnumerable Members

        public IEnumerator GetEnumerator()
        {
            throw new NotImplementedException();
        }

        #endregion

               
    }
    
}